#!/bin/bash
# ********************************************
# * 作者：			haiqiu
# * 脚本功能：	shell脚本
# * 脚本时间：	2025-10-09:08-55-27
# * 联系：			2477116273@qq.com
# ********************************************
. conf/font_color.conf
read -p "$(echo -e ${green}输入查询的用户名:${reset})" username

if grep ${username} /etc/passwd >> /dev/null 2>&1 
then
  echo "user id is :$(grep haiqiu /etc/passwd|awk -F ':' '{print $3}')"
  echo "default group is:$(grep haiqiu /etc/passwd|awk -F ':' '{print $4}')"
  echo "home directory is:$(grep haiqiu /etc/passwd|awk -F ':' '{print $6}')"
  echo "shell is : $(grep haiqiu /etc/passwd|awk -F ':' '{print $NF}')"
  echo "group memders info: $(grep -E ':10:' /etc/group | awk -F ':10:' '{print $2}')"
  if who | grep ${username} >> /dev/null 2>&1 
  then
    echo "${username} logged in"
  else
    echo "${username} NOT logged in"
  fi
else
  echo "user $username does not exist"
fi


